
import CryptoJS from "crypto-js";

//key的字符串要超過16個，iv要超過6個。否則解密出來為空
export const SECRET_KEY = CryptoJS.enc.Utf8.parse("compeq12345678900123");
export const SECRET_IV = CryptoJS.enc.Utf8.parse("99999999123");


export const decrypt = (password: any) => {
    // password = (password+'').replace(/\n*$/g,'').replace(/\n/g,'');
    const turePwddecrypt = CryptoJS.AES.decrypt(password, SECRET_KEY, {
      iv: SECRET_IV,
      mode: CryptoJS.mode.CBC,
      padding: CryptoJS.pad.Pkcs7
    });
    return CryptoJS.enc.Utf8.stringify(turePwddecrypt)
};
  